/*============================================================================
  Col Generators
==============================================================================*/

// Hack because can't override columns default param in mixin without doing this
// I don't know why.
$num-columns: $grid-columns;

// generates grid classes with format `grid-${n}`, "n" being the number of columns spanned. Ex grid-6 spans half of a 12-column grid.
// also generates `grid-push-${n}` classes to be used in conjunction with `grid=${n}` to offset an element from left by n columns
@mixin generate-columns($prefix: 'grid-', $num: $num-columns, $width: $column) {
  $i: $num;

  @while $i > 0 {
    .#{$prefix}#{$i} {
      width: ($width + $gutter) * $i - $gutter;

      @if $i < $num {
        margin-right: $gutter;
      }
    }

    .#{$prefix}push-#{$i} {
      margin-left: ($width + $gutter) * $i;
    }

    $i: $i - 1;
  }
}

@mixin generate-extended-columns($prefix: 'grid-', $num: $grid-columns, $width: $column, $extendor: 0) {
  $i: $num;

  @while $i > 0 {
    &.#{$prefix}#{$i} {
      $base-width: ($width + $gutter) * $i - $gutter;
      @if $extendor {
        width: $base-width + $extendor;
      } @else {
        width: $base-width;
      }
    }

    $i: $i - 1;
  }
}

@mixin page-container() {
  @include clearfix;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}
